#pragma once
#include "ImgResource.h"
#include "Action.h"
#include "Link.h"
#include < stdio.h >
#include < stdlib.h >
#include < vcclr.h >

ref class Scene
{
private:
	int aN;
	int lN;
	int aMax;
	int lMax;
	int sizek;

	void CreateObject(int x, int y, int type);
	int FindFreeA();
	int FindFreeL();

	int getFromNum(Link^ link);
	int getToNum(Link^ link);
	int getFromMax(Link^ link);
	int getToMax(Link^ link);
public:
	ImgResource ^res;
	array<Action ^>^ Actions;
	array<Link ^>^ Links;

	Scene();

	void paint();
	void Preload(System::Windows::Forms::ContextMenuStrip^ mRB);

	void CreateAction(int x,int y);
	void CreateStart(int x,int y);
	void CreateEnd(int x,int y);
	void CreateComment(int x,int y);
	void CreateSignal(int x,int y);
	void CreateSignalRecv(int x,int y);
	void CreateMultiplexerVert(int x,int y);
	void CreateMultiplexerHort(int x,int y);
	void CreateLink(int n1,int n2,int type);
	void DeleteObject(int n);
	void DeleteLink(int n);
	void SaveFile(System::String^ path);
	void OpenFile(System::String^ path);

	int isAction(System::Object^  object);
	int isLink(System::Object^  object);
	int getAMax();
	int getLMax();

	Scene^ MakeEqual(Scene^ other);

	char* convertString(System::String^ other);
};
